package com.hh.entity.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.*;
import com.hh.converter.UserGenderConverter;
import com.hh.converter.UserNoConverter;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户
 *
 * @TableName user
 */
@TableName(value = "user")
@Data
@ContentRowHeight(15)
@HeadRowHeight(20)
@ColumnWidth(25)
public class User implements Serializable {
    /**
     * id
     */
    @ExcelProperty(converter = UserNoConverter.class)
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 用户昵称
     */
    @TableField(value = "userName")
    private String userName;

    /**
     * 账号
     */
    @TableField(value = "userAccount")
    private String userAccount;

    /**
     * 用户头像
     */
    @ExcelIgnore
    @TableField(value = "avatarUrl")
    private String avatarUrl;

    /**
     * 性别
     */
    @ExcelProperty(value = "性别", converter = UserGenderConverter.class)
    @TableField(value = "gender")
    private Integer gender;

    /**
     * 密码
     */
    @ExcelIgnore
    @TableField(value = "userPassword")
    private String userPassword;

    /**
     * 手机号
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 邮箱
     */
    @TableField(value = "email")
    private String email;

    /**
     * 角色标识
     */
    @TableField(value = "userRole")
    private String userRole;

    /**
     * 状态 0 -正常
     */
    @ExcelIgnore
    @TableField(value = "userStatus")
    private Integer userStatus;

    /**
     * 创建时间
     */
    @ColumnWidth(30)
    @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
    @ExcelProperty("创建时间")
    @TableField(value = "createTime")
    private Date createTime;

    /**
     * 更新时间
     */
    @ColumnWidth(30)
    @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
    @ExcelProperty("更新时间")
    @TableField(value = "updateTime")
    private Date updateTime;

    /**
     * 是否删除
     */
    @ExcelIgnore
    @TableLogic
    private Integer isDelete;

    @ExcelIgnore
    @TableField(exist = false)
    private String token;

    @ExcelIgnore
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}